package com.qk.mapper;

import com.qk.entity.Dept;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DeptMapper {

    /**
     * 插入部门信息
     */
    @Insert("INSERT INTO dept(name, status, create_time, update_time) VALUES(#{name}, #{status}, #{createTime}, #{updateTime})")
    void insert(Dept dept);

    List<Dept> listDepts(String name, Integer status);

@Select( "Select id, name, status, create_time, update_time from dept where id = #{id}")
    Dept getById(Integer id);

    void update(Dept dept);

    @Delete("Delete from dept where id = #{id}")
    void deleteById(Integer id);

@Select("Select id, name, status, create_time, update_time from dept where status = 1 ")
    List<Dept>  listAll( );

}